Skip to main content

All Questions

0votes
2answers
57views

The instance of entity type 'VALUE' cannot be tracked because another instance with the same key value for {'OrderId'} is already being tracked

I decided to add models to work with the database. That's how it was and working public sealed class DatabaseContext : DbContext { public DbSet<Payment> Payments { get; set; } = null!; I ...
amg63's user avatar
1vote
1answer
142views

How to dynamically access tables across multiple databases using Entity Framework Core?

In my company, we have a system with the following structure: Moldable hosts: servers are defined by their IP addresses Moldable databases: each database is created based on a country code Company-...
Breno Pimentel da Silva's user avatar
0votes
1answer
75views

Dataflow thread safe db context

My app receives multiple files (50 files, each file with 1000 rows) and processes them in Dataflow blocks. In one of the blocks UploadToDatabaseBlock, I set MaxDegreeOfParalellism to 8. This creates ...
Mihai Socaciu's user avatar
0votes
1answer
55views

EF Core 8 : get child table count as a property of model

Ok, so back in the day we used the ADO and created entities, but now that Visual Studio Pro 2009 won't work with .NET 8 anymore, it seems to be the target for today's era. Anyways besides that I had a ...
Dave2022's user avatar
1vote
1answer
421views

Cannot create a DbSet for 'Product' because this type is not included in the model for the context

I'm trying to unit test the derived class of a dbContext. I keep getting the error message [Fact] public void GetAssync_Method_Called() { var options = new DbContextOptionsBuilder<CoreDbContext&...
Richard77's user avatar
0votes
1answer
72views

Entity Framework Core 8.0.10 does not load related data

I have the User and Role models. Where a many-to-many relationship is generated between both models, represented by a collection at both ends: ICollection<User> Users {get;set:} in the Role ...
Walter Molano's user avatar
0votes
0answers
45views

C# & EF Core : when add-migration, a exception is thrown " unable to create a 'DbContext' of type ''

This is my first time asking for help on Stack Overflow. If there are any rules that I didn't follow, just point them out, and I'll take note of them in the next question. An exception was thrown when ...
Hang's user avatar
0votes
0answers
35views

Different DbContext instances in my ASP.NET Core application sharing resources or combining queries

I'm working on an ASP.NET Core application where I have a DbContext instance injected via dependency injection. The context is registered as scoped. However, I'm experiencing an issue where, when ...
abab's user avatar
1vote
1answer
83views

Using EF Core DbContext and ASP.NET Core Identity's UserManager simultaneously

My user entity: public class User : IdentityUser<long> { public Office Office { get; set; } // not nullable // ...other custom properties } Suppose I want to create a new user: var ...
lonix's user avatar
  • 21.5k
0votes
0answers
43views

Exceptions On Multiple Submission of Form in Blazor EditForm

My Blazor Form works and does valid submission,but when I submit the form multiple times in a very small time interval, it gives different types of exceptions, like: Microsoft.AspNetCore.Components....
user24437316's user avatar
1vote
0answers
41views

Scaffold-DbContext, is it possible to skip modelBuilder.HasDefaultSchema in the generated code?

We generated Data (for DBContext) and Models by scaffolding an existing SQL Server database. In the result, we found the following checking of modelBuilder.HasDefaultSchema(). For scaffolding, we ...
Mike's user avatar
0votes
0answers
77views

AddDbContext Or AddDbContextPool in Multi Tenant Architecture

Which options to use when configuring the DBContext for multi tenant design. The application is a Dot net core WebAPI, with many customers each having separate Database. The DBContext connection ...
Varun L's user avatar
0votes
1answer
70views

Global configuration to store all enums as string even if they are defined as nullable

I want to have a global configuration in my DBContext to save all Enums in my model as string in the data store, the constraint is I need the config to work even if the Enum is nullable I already ...
wutangcodeclan's user avatar
-1votes
1answer
545views

Unable to create a 'DbContext' of type ' for type 'Microsoft.EntityFrameworkCore.DbContextOptions' [closed]

I want to add a migration but it is not working for me - I get this error: Unable to create a 'DbContext' of type ''. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore....
TUSHAR LADVA's user avatar
0votes
0answers
80views

How to use MSOLEDB in .NET Core with Entity Framework

I recently got to know that SQL native client will no longer support from SQL Server 2022 and we may need to upgrade the provider. Please refer to this official Microsoft document: MSDN My application ...
Techie Keeda's user avatar

153050per page
close